<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <?
        include '../head.php';
        ?>
        <style>
            #login
            {
                margin-top: 15%;      
                 margin-left: 25%;
                 box-shadow: #000 1px inset;
                 border: 1px solid black;
                 width: 300px;
                 padding: 10px 10px 10px 10px;
                 border-radius: 5px;
            }
        </style>
    </head>
    <body>
        <form>
        <div id="login" >
            <table>
                <tr>
                    <td>
                        <label class="btn btn-default" >  Username </label>
                    </td>
                    <td>
                        <input class="form-control" id="username" type="text" name="username" >
                    </td>
                </tr>
               <tr>
                    <td>
                        <label class="btn btn-default"> Password </label>
                    </td>
                    <td>
                        <input class="form-control" id="password" type="password" name="password" >
                    </td>
                </tr>
                <tr>
                    <td>
                        
                    </td>
                    <td style="float: right;" >
                        <input class="btn btn-primary" type="button" value="Masuk" onclick="login()" name="password" >
                    </td>
                </tr>
            </table>
        </div>
            </form>
    </body>
    <script type="text/javascript">
        function login()
        {
            var url;
            var username;
            var password;
            username = $('#username').val();
            password = $('#password').val();
            url='login_submit.php';
           $.ajax({
            type: "POST",
            url: url,
            data: {username:username,password:password},
            success: function(data)
            {
                if(data==1)
                    {
                        window.location.href ='../admin.php';
                        
                    }
                    else
                        {
                            alert('gagal login');
                        }
            }
            //dataType: dataType
            });
            
        }
    </script>
</html>
